

<template>
  <!--登录/注册的头部-->
  <div class="lr-top w1230">
    <a href="index.html"><img src="../assets/img/logo.png" width="150px" height="60px"/></a>
    <div class="top-link">
      <a href="#"class="top-link1"></a>
      <a href="#" class="top-link2"></a>
      <a href="#" class="top-link3"></a>
    </div>
  </div>
  <!--登录/注册的中部-->
  <div class="lr-main">
    <div class="w1230">
      <div class="reg-div">
        <h3 class="login-title">登录爱购</h3>
        <p class="go-reg">还没有爱购账号？<RouterLink to="/user/register">在此注册</RouterLink></p>
        <el-form :model="userQuery">
          <p><span class="icon-account"></span><input type="text" v-model="userQuery.userName" placeholder="请输入已注册的账号"/></p>
          <p><span class="icon-pwd"></span><input type="password" v-model="userQuery.userPwd" placeholder="请输入密码"/></p>
<!--          <p class="clear-float"><input type="text" placeholder="验证码" class="code"/><img src="../assets/img/code.jpg" width="110px" height="42px" class="code-img"/></p>-->
<!--          <p><input type="checkbox" class="chk-login"/><span>7天免登录</span></p>-->
          <el-button  class="sum-btn" @click="login">登录</el-button>
        </el-form>

      </div>
    </div>
  </div>
  <!--登录/注册的底部-->
  <div class="lr-footer footer">
    <p class="w1230">
      <a href="#">关于爱购</a>
      <a href="#">合作伙伴</a>
      <a href="#">营销中心</a>
      <a href="#">廉正举报</a>
      <a href="#">联系客服</a>
      <a href="#">开发平台</a>
      <a href="#">诚征英才</a>
      <a href="#">联系我们</a>
      <a href="#">网站地图</a>
      <a href="#">知识产权</a><span>|</span>
      <span>&copy;2018-2020 igo.com 版权所有</span>
    </p>
  </div>
</template>

<script>
import {doPost} from "../http/httpRequest.js";
import {messageTip} from "../util/util.js";

export default {
  name: "UserLoginView",
  data() {
    return {
      userQuery: {}
    }
  },

  methods: {
    login(){
      doPost("/login",this.userQuery).then(res => {
        console.log(res)
        if(res.data.code === 200){
          localStorage.setItem("user",JSON.stringify(res.data.data));
          localStorage.setItem("token",JSON.stringify(res.data.data.token));
          this.$router.push('/');
        }
      })
    }
  }
}
</script>
<style scoped>
@import '../assets/css/reset.css';
@import "../assets/css/top.css";
@import "../assets/css/index.css";
@import "../assets/css/footer.css";
@import "../assets/css/font-awesome-4.7.0/Font-Awesome-master/css/font-awesome.min.css";
@import '../assets/css/buyerTrade.css';
@import '../assets/css/classify.css';
@import '../assets/css/deliverAddress.css';
@import '../assets/css/goodsDetail.css';
@import '../assets/css/login.css';
@import '../assets/css/shoppingCart.css';
</style>